﻿// --------------------------------------------------------------------------------------------------------------------
// <copyright file="JobsAdminViewModel.cs" company="DST Nexdox">
//   Copyright (c) DST Nexdox. All rights reserved.
// </copyright>
// <summary>
//   Defines the JobsAdminViewModel type.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace DocProcessingWorkflow.Models.JobsAdmin
{
  using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Web;
  using DocProcessingWorkflow.Models.MailSortSetting;
  using DocProcessingWorkflow.Models.ManCo;

  public class JobsAdminViewModel
  {
    private readonly List<ManCoViewModel> manCos = new List<ManCoViewModel>();
    private readonly List<MailSortSettingViewModel> mailSortSettings = new List<MailSortSettingViewModel>();

    public String SelectedManCo { get; set; }

    public List<ManCoViewModel> ManCos
    {
      get
      {
        return this.manCos;
      }
    }

    public List<MailSortSettingViewModel> MailSortSettings
    {
      get
      {
        return this.mailSortSettings;
      }
    }

    public void AddManCos(IEnumerable<Entities.ManagementCompany> managementCompanies)
    {
      foreach (var mvm in managementCompanies.Select(manCo => new ManCoViewModel(manCo)))
      {
        this.ManCos.Add(mvm);
      }
    }

    public void AddMailSortSettings(IEnumerable<Entities.MailsortSetting> mailSortSettingEntities)
    {
      foreach (MailSortSettingViewModel mssViewModel in mailSortSettingEntities.Select(mssEntity => new MailSortSettingViewModel(mssEntity)))
      {
        this.mailSortSettings.Add(mssViewModel);
      }
    }
  }
}